{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0b382780",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 读取CSV文件（需替换实际文件名）\n",
    "df = pd.read_csv('items_with_2025_value_2.csv')\n",
    "\n",
    "# 验证必要列存在\n",
    "required_cols = ['name', 'logo', 'category', 'subcategory', '2025_value']\n",
    "missing = [col for col in required_cols if col not in df.columns]\n",
    "if missing:\n",
    "    raise ValueError(f\"缺少必要列: {', '.join(missing)}\")\n",
    "\n",
    "# 筛选并排序\n",
    "filtered = df[df['2025_value'] > 48][required_cols]\n",
    "result = filtered.sort_values(['category','subcategory' ])\n",
    "\n",
    "# 保存结果\n",
    "result.to_csv('filtered_data_2.csv', index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
